package musicstore.biz.impl;

import java.util.List;

import musicstore.biz.BizException;
import musicstore.biz.GenreBiz;
import musicstore.entity.Genre;
import musicstore.mapper.GenreMapper;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GenreBizImpl implements GenreBiz {
	@Autowired
	private GenreMapper genreMapper;
	
	public void add(Genre g)throws BizException {
		genreMapper.add(g);
	}

	public void update(Genre g) throws BizException {
		genreMapper.update(g);
	}

	public void delete(int id)throws BizException {
		genreMapper.delete(id);
	}

	public Genre fetchById(int id) {
		return genreMapper.fetchById(id);
	}

	public List<Genre> getAll() {
		return genreMapper.getAll();
	}

	@Override
	public Genre fetchByTitle(String name) {
		return genreMapper.fetchByTitle(name);
	}
}
